#include "VistaBanana.h"
#include "../modelo/Auxiliares/Figura.h"
#include "../common/Constantes.h"
VistaBanana::VistaBanana() {
}

VistaBanana::VistaBanana(Objeto* obj) : Vista(obj) { 
	std::string imgPath = IMAGEN_BANANA;
	this->imagen = Gdk::Pixbuf::create_from_file(imgPath);
}

VistaBanana::~VistaBanana() {}

void VistaBanana::draw(const Cairo::RefPtr<Cairo::Context>& cr, Gtk::Allocation& allocation) {
	const int height = allocation.get_height();
	const int lesser = obj->getFigura()->getAncho()*2;
	
	cr->save();
	
	cr->arc(obj->getX(), height - obj->getY(), lesser / 4.0, 0.0, 2.0 * M_PI); // full circle
	Gdk::Cairo::set_source_pixbuf(cr, this->imagen, obj->getX() - 10, height - obj->getY() - 10);
	cr->fill();

	//cr->fill_preserve();
	cr->restore();  // back to opaque black
	cr->stroke();
}
